<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sets the amount of data prefetched for each CLOB or BLOB.</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.oci-set-module-name.html">« oci_set_module_name</a></li>
      <li style="float: right;"><a href="function.oci-set-prefetch.html">oci_set_prefetch »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.oci8.html">OCI8 函数</a></li>
    <li>Sets the amount of data prefetched for each CLOB or BLOB.</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.oci-set-prefetch-lob" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">oci_set_prefetch_lob</h1>
  <p class="verinfo">(PHP 8.2, PECL OCI8 &gt;= 3.2)</p><p class="refpurpose"><span class="refname">oci_set_prefetch_lob</span> &mdash; <span class="dc-title">Sets the amount of data prefetched for each CLOB or BLOB.</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.oci-set-prefetch-lob-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>oci_set_prefetch_lob</strong></span>(<span class="methodparam"><span class="type">resource</span> <code class="parameter">$statement</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$prefetch_lob_size</code></span>): <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   Sets the internal buffer size used to fetch each CLOB or BLOB value when the
   implementation gets the internal Oracle LOB locator from the database after
   a successful query call to <span class="function"><a href="function.oci-execute.html" class="function">oci_execute()</a></span> and for each
   subsequent internal fetch request to the database.  Increasing this value
   can improve the performance of fetching smaller LOBs by reducing round-trips
   between PHP and the database.  Memory usage will change.
  </p>
  <p class="para">
   The value affects LOBs returned as OCILob instances and also those returned
   using <strong><code>OCI_RETURN_LOBS</code></strong>.
  </p>
  <p class="para">
   Call <span class="function"><strong>oci_set_prefetch_lob()</strong></span> before
   calling <span class="function"><a href="function.oci-execute.html" class="function">oci_execute()</a></span>.  If it is not called, the value
   of <a href="oci8.configuration.html#ini.oci8.prefetch-lob-size" class="link">oci8.prefetch_lob_size</a>
   is used.
  </p>
  <p class="para">
   The LOB prefetch value should only be set with Oracle Database 12.2 or later.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.oci-set-prefetch-lob-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">statement</code></dt>

     <dd>

       <p class="para">有效的 OCI8 报表标识符
由 <span class="function"><a href="function.oci-parse.html" class="function">oci_parse()</a></span> 创建，被 <span class="function"><a href="function.oci-execute.html" class="function">oci_execute()</a></span>
或 <code class="literal">REF CURSOR</code> statement 标识执行。</p>
     </dd>

    
    
     <dt>
<code class="parameter">prefetch_lob_size</code></dt>

     <dd>

      <p class="para">
       The number of bytes of each LOB to be prefetched, &gt;= 0
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.oci-set-prefetch-lob-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>true</code></strong>， 或者在失败时返回 <strong><code>false</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.oci-set-prefetch-lob-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-1880">
    <p><strong>示例 #1 Changing the LOB prefetch value for a query</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$conn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">oci_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'hr'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'welcome'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'localhost/XE'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$stid&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">oci_parse</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'SELECT&nbsp;myclob&nbsp;FROM&nbsp;mytable'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">oci_set_prefetch_lob</span><span style="color: #007700">(</span><span style="color: #0000BB">$stid</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">100000</span><span style="color: #007700">);&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;Set&nbsp;before&nbsp;calling&nbsp;oci_execute()<br /></span><span style="color: #0000BB">oci_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$stid</span><span style="color: #007700">);<br /><br />echo&nbsp;</span><span style="color: #DD0000">"&lt;table&nbsp;border='1'&gt;\n"</span><span style="color: #007700">;<br />while&nbsp;(</span><span style="color: #0000BB">$row&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">oci_fetch_array</span><span style="color: #007700">(</span><span style="color: #0000BB">$stid</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">OCI_ASSOC</span><span style="color: #007700">+</span><span style="color: #0000BB">OCI_RETURN_NULLS</span><span style="color: #007700">+</span><span style="color: #0000BB">OCI_RETURN_LOBS</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"&lt;tr&gt;\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;(</span><span style="color: #0000BB">$row&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$item</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;"</span><span style="color: #007700">.(</span><span style="color: #0000BB">$item&nbsp;</span><span style="color: #007700">!==&nbsp;</span><span style="color: #0000BB">null&nbsp;</span><span style="color: #007700">?&nbsp;</span><span style="color: #0000BB">htmlentities</span><span style="color: #007700">(</span><span style="color: #0000BB">$item</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">ENT_QUOTES</span><span style="color: #007700">)&nbsp;:&nbsp;</span><span style="color: #DD0000">"&amp;nbsp;"</span><span style="color: #007700">).</span><span style="color: #DD0000">"&lt;/td&gt;\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"&lt;/tr&gt;\n"</span><span style="color: #007700">;<br />}<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;/table&gt;\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">oci_free_statement</span><span style="color: #007700">(</span><span style="color: #0000BB">$stid</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">oci_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.oci-set-prefetch-lob-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member">
     <a href="oci8.configuration.html#ini.oci8.prefetch-lob-size" class="link">oci8.prefetch_lob_size</a>
     ini option
    </li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>